package com.example.retrofit.controller;

import com.example.retrofit.api.BaiduApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fans
 */
@Slf4j
@RestController
public class BaiduController {

    @Autowired
    private BaiduApi baiduApi;

    @GetMapping("/baidu/s/{wd}")
    public String baiduSearch(@PathVariable String wd) {
        String result = baiduApi.search(wd);
        log.info(result);
        return result;
    }

}
